import { ParamsPage, ResponsePage } from '@/api/common/type';
// <---------------- 供应商

// 列表 S
export type supplierParams = ParamsPage & SearchParams;

export interface SearchParams {
    supplierName: string;
    supplierCode: string;
    creator: string;
    dataSource: string;
    createStartTime: string;
    createEndTime: string;
}

export interface supplierResponse extends ResponsePage {
    records: SupplierRecords[];
}

export interface SupplierRecords {
    id: string;
    materialId: string;
    supplierCode: string;
    supplierName: string;
    supplierPhone: string;
    supplierPerson: string;
    materialCode: string;
    finishedProductRate: number;
    quasiDeliveryRate: number;
    materialName: string;
    creator: string;
    supplierMaterialId: string;
    dataSource: 'EXCEL' | 'ARTIFICIAL';
    createTime: string;
    updateTime: string;
    state: 'ENABLE' | 'DISABLE';
    children: {
        id: string;
        supplierId: string;
        materialId: string;
        materialCode: string;
        materialName: string;
        finishedProductRate: number;
        quasiDeliveryRate: number;
        supplierCode: string;
    }[];
}
// 列表 E

// 新增 S

export interface AddSupplierData {
    id?: string | null;
    supplierCode: string | null;
    supplierName: string | null;
    supplierPerson: string | null;
    supplierPhone: string | null;
    supplierMaterials: {
        materialId?: string;
        materialName?: string;
        materialCode?: string;
        supplierId?: string;
        finishedProductRate?: number | null;
        quasiDeliveryRate?: number | null;
    }[];
}

// 新增 E

// 供应商 ---------------->

// <---------------- 物料列表
export type MaterialParams = ParamsPage & MaterialSearchParams;

export interface MaterialSearchParams {
    materialCode?: string;
    materialName?: string;
}

export interface MaterialResponse extends ResponsePage {
    records: MaterialRecords[];
}

export interface MaterialRecords {
    id: string;
    materialCode: string;
    materialName: string;
    materialClassificationId: number;
    productType: string;
    classificationName: string;
    materialSpecification: string;
    manufacturingStrategy: 'MTS' | 'MTO';
    manufacturingStrategyName: string;
    inventory: number;
    actualInventory: number;
    safetyInventory: number;
    minimumOrderQuantity: number;
    maximumOrderQuantity: number;
    fixedLeadTime: number;
    fixedLeadTimeBatch: number;
    finishedProductRate: number | null;
    material: string;
    creator: string;
    dataSource: 'EXCEL' | 'ARTIFICIAL';
    unit?: string;
    createTime?: string;
    updateTime?: string;
    quasiDeliveryRate?: number | null;
    supplierId?: string;
    materialId?: string;
}

// 物料列表 ---------------->
